import React, { Component } from 'react'

export default class Son extends Component {
  state = { count: 0 }
  render() {
    if (this.state.count === 5) {
      throw new Error('I crash')
    }
    return (
      <div>
        <div>{this.state.count}</div>
        <button
          onClick={() => {
            this.setState({
              count: this.state.count + 1,
            })
          }}
        >
          按钮
        </button>
      </div>
    )
  }
}
